﻿@namespace AntDesign
@inherits SelectBase<TItemValue, TItem>
@typeparam TItemValue
@typeparam TItem

@using AntDesign.Internal
@using AntDesign.Select.Internal

@{
    base.BuildRenderTree(__builder);
}

@code
{
    protected override RenderFragment RenderOptionDropdown()
    {
        return @<div class="" style="max-height: @PopupContainerMaxHeight; overflow-y: auto;">
            <div>
                <div class="" role="listbox" style="display: flex; flex-direction: column;">
                  <CascadingValue Name="TreeSelect" Value="this" IsFixed="true">
                      <Tree @ref="_tree"
                          TItem="TItem"
                          BlockNode
                          DataSource="DataSource"
                          Multiple="Multiple"
                          Selectable="!TreeCheckable || !CheckOnClickNode"
                          Checkable="TreeCheckable"
                          CheckStrictly="TreeCheckStrictly"
                          CheckOnClickNode="CheckOnClickNode"
                          ExpandOnClickNode="ExpandOnClickNode"
                          OnClick="DoTreeNodeClick"
                          OnSelect="OnTreeNodeSelect"
                          CheckedKeysChanged="DoTreeCheckedKeysChanged"
                          ShowLeafIcon="ShowLeafIcon"
                          ShowIcon="ShowIcon"
                          ShowLine="ShowTreeLine"
                          TitleExpression="TitleExpression"
                          TitleTemplate="TitleTemplate"
                          TitleIconTemplate="TitleIconTemplate"
                          KeyExpression="KeyExpression"
                          IconExpression="IconExpression"
                          IsLeafExpression="IsLeafExpression"
                          ChildrenExpression="ChildrenExpression"
                          DisabledExpression="DisabledExpression"
                          CheckableExpression="CheckableExpression"
                          SelectableExpression="SelectableExpression"
                          DefaultExpandAll="TreeDefaultExpandAll"
                          DefaultExpandParent="TreeDefaultExpandParent"
                          DefaultExpandedKeys="TreeDefaultExpandedKeys"
                          SearchExpression="SearchExpression"
                          ExpandedKeys="ExpandedKeys"
                          MatchedStyle="@MatchedStyle"
                          MatchedClass="@MatchedClass"
                          SearchValue="@_searchValue"
                          OnNodeLoadDelayAsync="OnNodeLoadDelayAsync"
                          @attributes="TreeAttributes">
                        <Nodes>
                          @if (IsTemplatedNodes)
                          {
                            <CascadingValue Name="Tree" Value="_tree" IsFixed="true">
                              @ChildContent
                            </CascadingValue>
                          }
                        </Nodes>
                      </Tree>
                    </CascadingValue>
                </div>
            </div>
        </div>;
    }
}